<%-- Created by IntelliJ IDEA. --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
  <head>
    <title></title>
  </head>
  <script src="js/jquery-1.12.4.js" type="text/javascript">
  </script>
  <script type="text/javascript">
    $(function () {
      if($("table tr").next().text()==""){
        location.href = "ListServlet";
      }
    })
  </script>
  <body>
      <div>
        <button onclick="location.href='add.jsp'">车位租借</button>
        <table border="1">
          <tr>
            <th>租借人姓名</th>
            <th>车牌号</th>
            <th>租借状态</th>
            <th>到期日期</th>
            <th>操作</th>
          </tr>
          <c:forEach items="${list}" var="a">
            <tr>
              <td>${a.userName}</td>
              <td>${a.carNum}</td>
              <td>${a.status}</td>
              <td>${a.maturityDate}</td>
              <td>
                <a href="QueryServlet?&id=${a.id}">详细</a>
                <a href="DeleteServlet?&id=${a.id}">删除</a>
              </td>
            </tr>
          </c:forEach>
        </table>
      </div>
  </body>
</html>